<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ include file="/views/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>晒羊毛-撸羊毛有风险，投资需谨慎</title>
	<link rel="stylesheet" type="text/css" href="<%=path%>/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="<%=path%>/css/style.min.css">
	<link rel="stylesheet" type="text/css" href="<%=path%>/css/sym.css">
	<script type="text/javascript" src="<%=path%>/js/jquery.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/layer/layer.js"></script>
	<script type="text/javascript" src="<%=path%>/js/common.js"></script>
<body class="gray-bg">
<jsp:include page="/views/commons/header.jsp"></jsp:include>
	<div class="layout">
		<div class="hbox mb20">
			<div class="hd">
				<h3><a href="<%=path%>/views/channel/channel_list.jsp" class="c_666">渠道</a>
					<a href="<%=path%>/views/channel/channel_gray.jsp" style="font-size:14px;color:#35465d"  class="ml10">渠道灰名单</a></h3>
			</div>
			<div class="bd clearfix">
				<div class="lose_box">
					<div class="row">
						<form action="javascript:void(0);" id="channel_gray_choose_form">
							<div class="col-sm-4 mb20 col-sm-offset-3">
								<div class="input-group">
									<input type="text" class="form-control" name="keyWord" id="key_word" placeholder="请输入关键词">
									<span class="input-group-btn">
										<button class="btn btn-primary" type="button" onclick="javascript:queryChannelGrayList(1)">搜索</button>
									</span>
								</div>
							</div>
						</form>
						<c:choose>
						<c:when test="${sessionUserInfo!=null && sessionUserInfo.userId !=null}">
						<div class="col-sm-1"><button class="btn btn-white" id="jb_btn">我要举报</button></div>
						<script type="text/javascript">
						$(function(){
							$("#jb_btn").click(function(event) {
								//判断登录状后弹出下面内容
								//捕获页
								layer.open({
								  type: 1,
								  shade: false,
								  title:'我要举报',								  
								  area:['500px','300px'],
								  content: $('.form-horizontal'), //捕获的元素						  
								});
							});

						})
						</script>
						</c:when>
						<c:otherwise>
						<div class="col-sm-2"><a href="<%=path %>/uncheck/login">登录后举报 </a></div>
						</c:otherwise>
						</c:choose>
						<form action="javascript:insertChannelGray()" class="form-horizontal" style="display:none;" id="channel_gray_form">
							<div class="col-md-12" style="padding-top:30px;">

								<div class="form-group">
									<label class="col-sm-3 control-label">渠道商：</label>
									<div class="col-sm-9">
										<input type="text" name="channelName" class="form-control" placeholder="请输入渠道商"></div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label">举报项：</label>
									<div class="col-sm-9">
										<textarea rows="5" class="form-control" name="grayInfo"></textarea>
									</div>
								</div>
								<div class="form-group">
									<div class="col-sm-9 col-sm-offset-3">
										<button class="btn btn-primary" id="channel_gray_confirm_btn">提交</button>
									</div>
								</div>
							</div>
						</form>
					</div>
					<div class="table-responsive " id="channel_gray_list_div"></div>
				</div>
			</div>
		</div>
	</div>
<jsp:include page="/views/commons/footer.jsp"></jsp:include>
</body>
<script type="text/javascript">
$(document).ready(function(){
	queryChannelGrayList(1);
});

function queryChannelGrayList(pageNo){
	
	var queryData=$("#channel_gray_choose_form").serialize();
	
	if(queryData==null||queryData==""){
		queryData="pageNo="+pageNo;
	}else{
		queryData=queryData+"&pageNo="+pageNo;
	}
	
	$.ajax({
		url : path + "/uncheck/channelgray/list",
		type : "get",
		dataType : "html",
		data :queryData,
		success : function(data)
		{
			$("#channel_gray_list_div").html(data);
		},error:function(){
			layer.msg("服务器网络繁忙",{icon: 2});
		}
	});
}

function insertChannelGray(){
	$("#channel_gray_confirm_btn").addClass("disabled").attr("disabled","disabled").val("提交中");
	$.ajax({
		url : path + "/check/channelgray/insert",
		type : "post",
		dataType : "json",
		data : $("#channel_gray_form").serialize(),
		success : function(data)
		{
			if(data.result){
				layer.msg("发布成功",{icon: 1});;
				window.location.href=path + "/views/channel/channel_gray.jsp";
			}else{
				layer.msg(data.message,{icon: 2});;
				$("#channel_gray_confirm_btn").removeClass("disabled").removeAttr("disabled").val("提交");
			}
		},error:function(){
			layer.msg("服务器网络繁忙",{icon: 2});
			$("#channel_gray_confirm_btn").removeClass("disabled").removeAttr("disabled").val("提交");
		}
	});
}
</script>
</html>